package com.example.medmobile.profissional;

import java.io.IOException;

import utils.BaseActivity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView;

import com.cedarsoftware.util.io.JsonReader;
import com.example.medmobile.R;
import com.google.appengine.medmobileserver.business.Paciente;

public class PerfilPaciente extends BaseActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_perfil_paciente);
		Bundle alFiltro = getIntent().getExtras();
		String sJson = alFiltro.getString("Paciente");
		Paciente paciente;
  TextView txtNome = (TextView) findViewById(R.id.PerfilPacienteNome);
  TextView txtCPF = (TextView) findViewById(R.id.PerfilPacienteCPF);
  TextView txtEmail = (TextView) findViewById(R.id.PerfilPacienteEmail);
  TextView txtFone = (TextView) findViewById(R.id.PerfilPacienteFone);
  TextView txtPlanoSaude = (TextView) findViewById(R.id.PerfilPacientePlanoSaude);  
			try {
				paciente = (Paciente) JsonReader.jsonToJava(sJson);
				txtNome.setText(paciente.getNome() );
				txtCPF.setText(paciente.getCpf());
				txtEmail.setText(paciente.getEmail());
				txtFone.setText(paciente.getTelefone());
				if (paciente.getPlanoSaude() != null)
				  txtPlanoSaude.setText(paciente.getPlanoSaude().getPlano());
				else
					txtPlanoSaude.setText("");
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.perfil_paciente, menu);
		return true;
	}



}
